<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
	<title></title>
	<base href="__STATIC__/Admin/">
	<link href="styles/general.css" rel="stylesheet" type="text/css" />
	<link href="styles/main.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>
	<span class="action-span"><a href="{:url('Admin/Goods/goods_add')}">添加新商品</a></span>
	<span class="action-span1"><a href="{:url('Admin/Index/main')}">SHOP 管理中心</a> </span><span id="search_id" class="action-span1"> - 商品列表 </span>
	<div style="clear:both"></div>
</h1>

<div class="form-div">
  <form action="{:url('Admin/Goods/goods_list')}" method="get" name="searchForm">
    <img src="images/icon_search.gif" width="26" height="22" border="0" alt="SEARCH">
        <!-- 分类 -->
    <select name="cat_id">
		<option value="">所有分类</option>
		{foreach $cat as $v}
			<option value="{$v.cat_id}"><?php echo str_repeat("&nbsp;&nbsp;&nbsp;├",substr_count($v['new'],"-")-1) ?>{$v.cat_name}</option>
		{/foreach}
	</select>
    <!-- 品牌 -->
    <select name="brand_id">
		<option value="">所有品牌</option>
		{foreach $brand as $v}
		<option value="{$v.brand_id}">{$v.brand_name}</option>
		{/foreach}
	</select>
    <!-- 推荐 -->
    <select name="intro_type">
		<option value="">全部</option>
		<option value="is_best">精品</option>
		<option value="is_new">新品</option>
		<option value="is_hot">热销</option>
	</select>
         

    <!-- 上架 -->
     <select name="is_sale">
		<option value="">全部</option>
		<option value="1">上架</option>
		<option value="2">下架</option>
	</select>
	<!-- 关键字 -->
		关键字 <input type="text" name="keywords" size="15">
		<input type="submit" value=" 搜索 " class="button">
  </form>
</div>

  <!-- start goods list -->
	<div class="list-div" id="listDiv">
		<table cellpadding="3" cellspacing="1">
			<tbody>
				<tr>
					<th><input type="checkbox">编号</th>
					<th>商品名称</th>
					<th>商品图片</th>
					<th>货号</th>
					<th>价格</th>
					<th>上架</th>
					<th>精品</th>
					<th>新品</th>
					<th>热销</th>
					<th>库存</th>
					<th>操作</th>
				</tr>
			{foreach $data as $v}
				<tr>
					<td align="center"><input type="checkbox" name="checkboxes[]" value="">{$v.goods_id}</td>
					<td class="first-cell" align="center"><span>{$v.goods_name}</span></td>
					<td align="center"><img src="__ROOT__{$v.img_url}" width="50" height="50"></td>
					<td><span>{$v.goods_sn}</span></td>
					<td align="right"><span>{$v.goods_price}</span></td>
					{if condition="($v['is_sale'] == 2)"}
			            <td align="center"><img src="images/no.gif" onclick=""></td>
			          {elseif condition="($v['is_sale'] == 1)"/}
			            <td align="center"><img src="images/yes.gif" onclick=""></td>
			        {/if}
			        {if condition="($v['is_best'] == 0)"}
			            <td align="center"><img src="images/no.gif" onclick=""></td>
			          {elseif condition="($v['is_best'] == 1)"/}
			            <td align="center"><img src="images/yes.gif" onclick=""></td>
			        {/if}
			        {if condition="($v['is_new'] == 0)"}
			            <td align="center"><img src="images/no.gif" onclick=""></td>
			          {elseif condition="($v['is_new'] == 1)"/}
			            <td align="center"><img src="images/yes.gif" onclick=""></td>
			        {/if}
			        {if condition="($v['is_hot'] == 0)"}
			            <td align="center"><img src="images/no.gif" onclick=""></td>
			          {elseif condition="($v['is_hot'] == 1)"/}
			            <td align="center"><img src="images/yes.gif" onclick=""></td>
			        {/if}
					<td align="right"><span onclick="">{$v.goods_number}</span></td>
					<td align="center">
						<a href="javascript:;" title="编辑"><img src="images/icon_edit.gif" width="16" height="16" border="0"></a>
						<a href="javascript:;" title="回收站" class="hsz" id="{$v.goods_id}"><img src="images/icon_trash.gif" width="16" height="16" border="0"></a>         
					</td>
				</tr>
			{/foreach}
  </tbody>
 </table>

</div>

<!-- <div>
	<input type="hidden" name="act" value="batch">
	<select name="type" id="selAction" onchange="changeAction()">
		<option value="">请选择...</option>
		<option value="trash">回收站</option>
		<option value="on_sale">上架</option>
		<option value="not_on_sale">下架</option>
		<option value="best">精品</option>
		<option value="not_best">取消精品</option>
		<option value="new">新品</option>
		<option value="not_new">取消新品</option>
		<option value="hot">热销</option>
		<option value="not_hot">取消热销</option>
		<option value="move_to">转移到分类</option>
		<option value="suppliers_move_to">转移到供货商</option>
	</select>

    <input type="button" value=" 确定 " class="button">
</div>
 -->
<div>{$data->render()}</div>
<div id="footer">
	版权所有 &copy; 2006-2013 软工教育 - 高级PHP - 
</div>

</body>
<script src="jquery.js"></script>
<script>
	$(".hsz").on('click',function(){
		 var id = $(this).attr('id');
		 $.ajax({
		 	url:"{:url('Admin/Goods/goods_recycle')}",
		 	type:'get',
		 	data:{id:id},
		 	dataType:'json',
		 	success:function(e){
		 		if(e.code == 1){
		 			alert(e.msg);
		 			history.go(0)
		 		}else{
		 			alert(e.msg);
		 			history.go(0)
		 		}
		 	}
		 });
	});
</script>
</html>